﻿using IQIGame.Onigao.Framework.Serialization;
using IQIGame.Onigao.GamePlay;

namespace IQIGame.Onigao.Logic
{
    public class SkillEffective_ReplaceBuffDotType : SkillEffective
    {
        protected override ISerializeCustomPOD OnExecute(SkillEffectiveData data, Unit target, SkillEffectiveContext context, int effectiveIndex, out SkillEffectiveResponse startResp)
        {
            startResp = null;
            if (data.effectiveConfig.customConfig is SkillEffective_RepalceBuffDotType_ConfigData rConfig && context.param is BuffHandler rHandler)
            {
                rHandler.dotType = rConfig.dotType;
            }

            return null;
        }

        protected override ISerializeCustomPOD OnActionExecute(SkillEffectiveData data, SkillActionNode action, Unit target, ref SkillEffectiveContext context, int effectiveIndex)
        {
            if (action.customConfig is SkillEffectiveAction_RepalceBuffDotType_ConfigData rConfig && context.param is BuffHandler rHandler)
            {
                rHandler.dotType = rConfig.dotType;
            }

            return null;
        }

#if UNITY_EDITOR
        public override string ToString(SkillCustomConfig config)
        {
            return "提换buff的Dot伤害类型";
        }
#endif
    }
}